﻿using System;
using System.Windows.Forms;
using AxSawyer;

namespace TestAxSawyer
{
    public partial class testForm : Form
    {
        private AxSawyer.AxSawyer axSawyer = new AxSawyer.AxSawyer();

        public testForm()
        {
            InitializeComponent();
        }

        private void testConToDb_Click(object sender, EventArgs e)
        {
            axSawyer = new AxSawyer.AxSawyer();
            axSawyer.PrepareNames();

            statMonitor.Text += axSawyer.Msg() + Environment.NewLine;
        }

        private void butClose_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void buttDxSize_Click(object sender, EventArgs e)
        {
            axSawyer.OpenDataBase();
                labDxSize.Text = axSawyer.DSizeXstr(Convert.ToInt32(textBoxDxSize.Text));
            axSawyer.CloseDataBase();
        }

        private void buttDySize_Click(object sender, EventArgs e)
        {
            axSawyer.OpenDataBase();
                labDySize.Text = axSawyer.DSizeYstr(Convert.ToInt32(textBoxDySize.Text));
            axSawyer.CloseDataBase();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void butMatId_Click(object sender, EventArgs e)
        {
            axSawyer.OpenDataBase();
            labMatId.Text = axSawyer.MaterialNameById(textMatId.Text);
            axSawyer.CloseDataBase();
        }
    }
}
